package com.yonyou.pmclouds.alterandvisacategory.process;

import com.yonyou.pmclouds.alterandvisacategory.entity.AlterAndVisaCategoryVO;
import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.ref.itf.RefCodeConst;
import com.yonyou.pmclouds.basecom.ref.itf.ReferenceChecker;
import org.springframework.beans.factory.annotation.Autowired;

public class AlterAndVisaCategoryDeleteCheckProcessor implements SingleProcessor<AlterAndVisaCategoryVO> {

    private ReferenceChecker referenceChecker;
    public AlterAndVisaCategoryDeleteCheckProcessor(ReferenceChecker referenceChecker) {
        this.referenceChecker = referenceChecker;
    }
    @Override
    public void process(AlterAndVisaCategoryVO vo, AlterAndVisaCategoryVO orig) throws BusinessException {
        if(vo == null) return;
        if(referenceChecker.checkReferenced(RefCodeConst.ALTERANDVISACATEGORY, new String[]{vo.getPkAltervisacategory()})){
            throw new BusinessException("该档案已被引用，无法删除！");
        }
    }
}
